package com.nbsaas.boot.order.rest.resource;

import com.nbsaas.boot.order.api.apis.OrderRefundApi;
import com.nbsaas.boot.order.data.entity.OrderRefund;
import com.nbsaas.boot.order.api.domain.request.OrderRefundRequest;
import com.nbsaas.boot.order.api.domain.response.OrderRefundResponse;
import com.nbsaas.boot.order.api.domain.simple.OrderRefundSimple;
import com.nbsaas.boot.order.rest.convert.OrderRefundSimpleConvert;
import com.nbsaas.boot.order.rest.convert.OrderRefundEntityConvert;
import com.nbsaas.boot.order.rest.convert.OrderRefundResponseConvert;
import com.nbsaas.boot.order.data.repository.OrderRefundRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   订单退款-业务接口实现
*/
@Transactional
@Service
public class OrderRefundResource extends BaseResource<OrderRefund,OrderRefundResponse, OrderRefundSimple, OrderRefundRequest>  implements OrderRefundApi {

    @Resource
    private OrderRefundRepository orderRefundRepository;

    @Override
    public JpaRepositoryImplementation<OrderRefund, Serializable> getJpaRepository() {
        return orderRefundRepository;
    }

    @Override
    public Function<OrderRefund, OrderRefundSimple> getConvertSimple() {
        return new OrderRefundSimpleConvert();
    }

    @Override
    public Function<OrderRefundRequest, OrderRefund> getConvertForm() {
        return new OrderRefundEntityConvert();
    }

    @Override
    public Function<OrderRefund, OrderRefundResponse> getConvertResponse() {
        return new OrderRefundResponseConvert();
    }




}


